Skip to content

fix(chat): restrict tool media delivery to allowlisted tools - #3204

Merged
liukewia merged 1 commit into
TencentCloud:developfrom
liukewia:fix/tool-media-delivery-filter
Nov 28, 2026
Merged

liukewia merged 1 commit into
TencentCloud:developfrom
liukewia:fix/tool-media-delivery-filter

Conversation

@liukewia

Copy link
Copy Markdown
Collaborator

Summary

  • Restrict inferred tool media in chat history and turn rendering to explicit delivery tools.
  • Preserve media delivery markers and attachments while preventing stale paths from ls, execute, and read_file outputs from appearing as new attachments.
  • Add backend and dashboard regression coverage for the filtering behavior.

Target branch

  • Base is `develop` (feature / fix — default)
  • Base is `main` (`release/` or `hotfix/` only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

  • Backend: `uv run pytest tests/unit/api/test_chat_polish.py tests/unit/gateway/test_tool_media.py -q` — 73 passed.

  • Dashboard: `npm test -- --run src/utils/collectTurnToolMedia.test.ts src/utils/toolMediaBlocks.test.ts` — 19 passed.

  • Patch check: `git diff --check upstream/develop...HEAD` — passed.

  • `make all` passes locally

  • Added/updated tests

Checklist

  • Updated `CHANGELOG.md` (if user-facing)
  • README / docs updated (if needed)

…ndling logic

- Introduced new tests for `collectTurnToolMedia` to ensure proper filtering of media from tool messages.
- Enhanced `collectTurnToolMedia` and related functions to correctly identify and handle media delivery tools.
- Updated `toolMediaBlocks` to support inference of image paths from plain-text outputs for allowed tools.
- Improved backend serialization to include tool names in media enrichment logic.
@liukewia
liukewia merged commit 462fc15 into TencentCloud:develop Nov 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant